package com.grape.springbootgradle20220520.record;

public record MyRecord(String name, Integer age) {
    public static MyRecord of() {
        return new MyRecord("", 0);
    }

    public static MyRecord of(String name, Integer age) {
        return new MyRecord(name, age);
    }

    public MyRecord(String name,Integer age){
        if (0>age){
            try {
                throw new IllegalAccessException();
            } catch (IllegalAccessException e) {
                throw new RuntimeException(e);
            }
        }
        this.name=name;
        this.age=age;
    }
}
